package com.itzxx.huazhun.data.model

import android.content.Context
import androidx.core.content.ContextCompat
import com.itzxx.huazhun.R
import com.itzxx.library_base_ktx.base.appContext
import java.text.SimpleDateFormat
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.Date

data class UserAuditInfo(
    val cursor: String,
    val isLast: Boolean,
    val list: List<ApprovalUserInfo>
)

data class ApprovalUserInfo(
    val address: String,
    val applicationName: String,
    var approvalStatus: Int,
    val createTime: String,
    val id: Int,
    val phone: String,
    val postName: String,
    var refuseRemark: String,
    val tenantId: Int,
    val tenantName: String,
    val userName: String
) {
    fun getCreateTimeStr(): String {
        val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
        val currentDate = Date(createTime.toLong())
        return dateFormat.format(currentDate)
    }

    fun isAuditStatus(): Boolean {
        return approvalStatus == 0
    }

    fun getAuditStatusStr(): String {
        when (approvalStatus) {
            1 -> return "审核通过"
            2 -> return "拒绝申请"
            else -> return "待审核"
        }
    }

    fun getAuditStatusTextColor(): Int {
        when (approvalStatus) {
            1-> return ContextCompat.getColor(appContext, R.color.main_text_light_color)
            else -> return ContextCompat.getColor(appContext, R.color.main_text_error_color)
        }
    }
}